import java.util.Scanner;

public class demo02 {
    //玩具蛇
    public static int count=0;
    public static int[] dx={0,1,0,-1};
    public static int[] dy={1,0,-1,0};
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                int[][] arr=new int[4][4];
                int sum=16;
                arr[i][j]=1;
                dfs(arr,i,j,sum);
            }
        }
        System.out.println(count);
    }
    public static void dfs(int[][] arr,int i,int j,int sum){
        if(sum==1){
            count++;
            return;
        }
        for (int k = 0; k < 4; k++) {
            int x=i+dx[k];
            int y=j+dy[k];
            if((x>=0&&x<4)&&(y>=0&&y<4)&&(arr[x][y]==0)) {
                arr[x][y] = 1;
                dfs(arr, x, y, sum - 1);
                arr[x][y] = 0;
            }
        }
    }
}
